/* nrf24l01.h */

#ifndef __NRF24L01_H__
#define __NRF24L01_H__

#include <stdint.h>
#include <stdbool.h>
#include <string.h>

#define NRF24L01_XFER_ADDRESS_LENGTH  5U
#define NRF24L01_XFER_PACKAGE_LENGTH  32U

/* Hardware adapter interfaces. 
* These function should be implemented on particular hardware.
*/
void NRF24L01_HW_InitIO(void);
uint8_t NRF24L01_HW_SpiSwapData(uint8_t txData, bool enKeepCs);
void NRF24L01_HW_GpioSetCEPin(bool enLogicOne);
bool NRF24L01_HW_GpioGetIrqPin(void);

typedef struct
{
    uint8_t TxAddr[5];
    uint8_t RxAddr[5];
} NRF24L01_Config_T;

bool NRF24L01_Init(NRF24L01_Config_T *configPtr);
bool NRF24L01_GetRxPackageReadyFlag(void);
void NRF24L01_ClearRxPackageReadyFlag(void);
void NRF24L01_GetRxPackage(uint8_t *rxBufPtr);
bool NRF24L01_TxPackage(uint8_t *txBufPtr);
void NRF24L01_WaitXferDone(void);

#endif /* __NRF24L01_H__ */

